import request from '../network/request.js'

const publicModule = {
	namespaced: true,

	actions: {

	},

	mutations: {
		// 获取 token && sccountNumber
		setToken(state) {
			uni.getStorage({
				key: 'token',
				success(res) {
					state.token = res.data
				}
			})
			uni.getStorage({
				key: 'sccountNumber',
				success(res) {
					state.sccountNumber = res.data
				}
			})
		},

		// 清除 token
		removeToken(state) {
			uni.removeStorage({
				key: 'token'
			})
			state.token = ''
		},

		// 复制内容
		copyText(state, value) {
			uni.setClipboardData({
				data: value,
				success() {
					uni.showToast({
						title: '复制成功',
						icon: 'success',
						duration: 100
					})
				}
			})
		}
	},

	state: {
		token: '',
		sccountNumber: ''
	},

	getter: {

	}
}

export default publicModule